#include <bits/stdc++.h>
typedef long long LL;
using namespace std;
const LL INF = 0x3f3f3f3f;
const LL MAX = 1e5 + 5;
LL n, monster[MAX], ans;
bool all_empty(int n_max)
{
    for(int i = 1; i <= n_max; i++) {
        if(monster[i] != 0) {
            return false;
        }
    }
    return true;
}
int only_one(int n_max)
{
    int flag = -1;
    for(int i = 0; i <= n_max; i++) {
        if(monster[i] != 0 && flag != -1) {
            //cout << " but " << i << " is here too\n";
            return -1;
        }
        else if(monster[i] != 0 && flag == -1) {
            //cout << "now is " << i << " only";
            flag = i;
        }
    }
    //cout << ".\n";
    return flag;
}
int w_max()
{
    for(int i = MAX - 5; i >= 1; i--) {
        if(monster[i] != 0) {
            return i;
        }
    }
}
int main()
{
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    cin >> n;
    for(int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        monster[x]++;
    }
    LL n_max;
    do{
        ans ++;
        n_max = w_max();
        for(int i = 1; i <= n_max; i++) {
            if(monster[i] != 0) {
                monster[i]--;
            }
        }
        //cout << "ans = " << ans << "\nonly " << only_one(n_max) << " and the number is " << monster[only_one(n_max)] << ". Now is" << (all_empty(n_max) ? " empty" : "n't empty") << ". the max number is " << w_max() << endl;
    }while(!all_empty(n_max) && only_one(n_max) == -1);

    if(all_empty(n_max)) {
        //cout << "here is \"end 1\"" << endl;
        cout << ans << endl;
    }
    else{
        //cout << "here is \"end 2\"" << endl;
        cout << ans + monster[only_one(n_max)] << endl;
    }
    return 0;
}
